@echo off
echo === 构建 go-agent.exe ===
echo.

echo 设置Go环境变量...
set GOCACHE=%CD%\.gocache
set GOMODCACHE=%CD%\.gomodcache
set GO111MODULE=on

echo GOCACHE: %GOCACHE%
echo GOMODCACHE: %GOMODCACHE%
echo.

echo 创建缓存目录...
if not exist ".gocache" mkdir .gocache
if not exist ".gomodcache" mkdir .gomodcache

echo 开始构建...
go build -o go-agent.exe cmd/agent/main.go

if %ERRORLEVEL% EQU 0 (
    echo ✅ 构建成功！生成文件: go-agent.exe
    echo.
    echo 文件信息:
    dir go-agent.exe
    echo.
    echo 构建完成！可以运行 go-agent.exe 来测试
) else (
    echo ❌ 构建失败！错误代码: %ERRORLEVEL%
)

echo.
pause